/*********************
* Author:Dzlua
* QQ:505544956
* time:2016/12/03
*/
#include "LuaVerticalLayout.h"
#include "../../utilities/Log.h"

#ifdef EDUI_USE_LUAPLUS

EDUI_NAMESPACE_BEGIN

#define CObjPtr (VerticalLayout::ToVerticalLayout(m_cobj))

void* LuaVerticalLayout::GetInterface(void* data)
{
    if (!data) return 0;
    LuaVerticalLayout* verticalLayout = new LuaVerticalLayout((VerticalLayout*)data);
#ifdef EDUI_TEST_NEW_DELETE
    ++m_newdeleteNum;
    Log("[LuaVerticalLayout] new LuaVerticalLayout : %d, %d", verticalLayout, data);
#endif
    return verticalLayout;
}

void LuaVerticalLayout::Release()
{
#ifdef EDUI_TEST_NEW_DELETE
    --m_newdeleteNum;
    Log("[LuaVerticalLayout] delete LuaVerticalLayout : %d, %d, %s", this, m_cobj, this->GetName());
#endif
    delete this;
}

LuaVerticalLayout::LuaVerticalLayout(VerticalLayout* verticalLayout) : LuaContainer(verticalLayout)
{}

LuaVerticalLayout::~LuaVerticalLayout()
{}

//----------------------------------------//

bool LuaVerticalLayout::IsCenter()
{
    return CObjPtr->IsCenter();
}

void LuaVerticalLayout::SetCenter(bool bCenter)
{
    CObjPtr->SetCenter(bCenter);
}

//----------------------------------------//

void LuaVerticalLayout::Register(LuaState *L)
{
    LuaObject obj = LuaHelperNS::AddToMetas(L, "VerticalLayout", "Container");
    obj.SetObject("__index", obj);
    obj.RegisterDirect("__NewCObj__", &LuaVerticalLayout::GetInterface);

    obj.RegisterObjectDirect("IsCenter", (LuaVerticalLayout*)0, &LuaVerticalLayout::IsCenter);
    obj.RegisterObjectDirect("SetCenter", (LuaVerticalLayout*)0, &LuaVerticalLayout::SetCenter);
}

#undef CObjPtr

EDUI_NAMESPACE_END

#endif